package datatypes.r2.basic.impl;

import javax.persistence.Embeddable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import datatypes.r2.basic.ST;
import datatypes.r2.flavors.ST_NT;
import datatypes.r2.flavors.ST_SIMPLE;
import datatypes.r2.flavors.impl.StringNoTranslations;
import datatypes.r2.foundation.DSET;

/**
 * Text data, primarily intended for machine processing (e.g., sorting,
 * querying, indexing, presentation, etc.).
 * 
 * ST is primarily used for names, symbols, and formal expressions. ST is a
 * restricted ED, whose ED.mediaType property is fixed to text/plain, and whose
 * data SHALL be inlined and not compressed. Thus, the properties compression,
 * reference, integrity check, algorithm, and thumbnail are not applicable. The
 * character string data type is used when the visual presentation of text does
 * not affect its meaning, which is true for formalized text and all kinds of
 * names.
 * 
 * @author Obama
 * 
 */
@javax.persistence.Entity
public class CharacterString extends EncapsulatedData implements ST {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;
	
	@ManyToOne
	@JoinColumn(name = "headCharacter_id")
	private StringNoTranslations headCharacter;
	@ManyToOne
	@JoinColumn(name = "tailString_id")
	private StringNoTranslations tailString;
	private DSET<StringNoTranslations> translation;

	@Override
	public ST_NT headCharacter() {

		return headCharacter;
	}

	@Override
	public ST_NT tailString() {

		return tailString;
	}

	@Override
	public ST_SIMPLE literal() {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * Alternate renditions of the same content translated into a different
	 * language. The translation property is a set of ST.NT that each translate
	 * the first rendition into a different language. Each element of the
	 * translation set SHALL be a translation of the ST value. Translations
	 * SHALL NOT contain translations.
	 */
	@Override
	public DSET<? extends ST_NT> translation() {
		return translation;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

}
